package com.kjzy.controller;

import com.kjzy.config.OrderProperties;
import com.kjzy.pojo.Order;
import com.kjzy.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Value("${server.port}")
    private String serverPort;

    @Autowired
    private OrderProperties orderProperties;

    @Autowired
    private OrderService orderService;
    @GetMapping("/{id}")
    public Order getOrderById(@PathVariable Integer id){
        System.out.println("端口号："+serverPort);
        System.out.println("user.test："+orderProperties.getTest());
        return  orderService.getOrderById(id);
    }
    @GetMapping
//    @ApiOperation: 用于描述接口的功能
    public List<Order> getAllOrders(){
        return  orderService.getAllOrders();
    }


}
